package org.example.config;

import org.example.condition.MyCondition;
import org.example.service.SayHelloService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyConfig {

    @Bean
    @Conditional(MyCondition.class) // 当环境中配置了useSayHelloService这个属性且它的值为"true"的时候才创建这个bean
    public SayHelloService sayHelloService(){
        return new SayHelloService();
    }
}
